package application;

import java.util.ArrayList;
import java.util.List;

public class Session {
    private Account account;
    private static Session session = null;
    private List<Withdraw> withdraws=new ArrayList<Withdraw>();

    public Session(Account account) {
        super();
        this.account=account;
    }


    public static Session getSession(Account account) {
        if(account!=null) {
            session = new Session(account);
        }
        return session;
    }
    public Account getSessionAccount() {
        return account;
    }
    public Withdraw createWithdrawSession() {
        Withdraw withdraw=null;
        if(session!=null) {
            withdraw = new Withdraw(session.getSessionAccount());
            withdraws.add(withdraw);
        }
        return withdraw;
    }
    public void closeSession() {
        session=null;
    }
    public List<Withdraw> getWithdraws() {
        return withdraws;
    }
}
